#!/bin/bash
# Author: Redbrother
# Email: 728083668@qq.com
# WebSite: https://help.ubuntu.com/community/LiveCDCustomizationFromScratch
# license: None
set -e
#自定义版本项
ARCH=amd64
RELEASE=focal
installer_url=http://mirrors.aliyun.com/ubuntu/
IMAGE=ubuntu-$RELEASE

if [ "`whoami`" != "root" ]; then
	echo "User must be root 需要root权限."
	exit 0
fi

if [ "`which mkisofs`" == "" ]; then
	ln -s /usr/bin/genisoimage /usr/bin/mkisofs
fi

############################################

rm -rf oldcd newcd
mkdir -p oldcd newcd
mount  deepin-live*.iso  oldcd  -o  loop
cp  oldcd/*   newcd/     -rp
umount  oldcd

### unpack the live system
unsquashfs newcd/live/filesystem.squashfs



source mountx.sh
cp -rf bash.bashrc squashfs-root/etc/

cd squashfs-root
chroot . locale-gen zh_CN.UTF-8
chroot . locale-gen en_US.UTF-8
chroot . mkdir -p /var/log/apt
# chroot . export LANG=C.UTF-8
# chroot . export DEBIAN_FRONTEND=noninteractive
# chroot . export APT_LISTCHANGES_FRONTEND=none
chroot . dpkg-reconfigure localepurge
chroot . apt-get update
chroot . apt-get install -y firmware-realtek firmware-iwlwifi bash-completion git
cd ..


